package com.huawei.appgallery.shortcutmanager.impl;

import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.huawei.hwid.core.constants.HwAccountConstants;
import java.util.HashMap;
import java.util.Map;
import o.cyf.d;
import o.cyh;

public class RequestResultReceiver extends BroadcastReceiver {
    private static final Map<String, d> ˋ = new HashMap();

    @NonNull
    public static PendingIntent getRequestPinShortcutResultIntent(@NonNull Context context, @NonNull String str, @NonNull d dVar) {
        if (context == null || TextUtils.isEmpty(str)) {
            throw new IllegalArgumentException("context must not be null, and shortcutId must not be null or empty.");
        }
        Intent intent = new Intent("RequestResultReceiver.ACTION_INSTALLED_SHORTCUT");
        intent.setComponent(new ComponentName(context, RequestResultReceiver.class));
        intent.putExtra("shortcut_id", str);
        ˋ.put(str, dVar);
        return PendingIntent.getBroadcast(context, 0, intent, HwAccountConstants.FLAG_TRANS_NAVIGATION_BAR);
    }

    public void onReceive(Context context, Intent intent) {
        if (context != null && intent != null && "RequestResultReceiver.ACTION_INSTALLED_SHORTCUT".equals(intent.getAction())) {
            CharSequence ˎ = cyh.ˎ(intent, "shortcut_id");
            if (!TextUtils.isEmpty(ˎ)) {
                d dVar = (d) ˋ.remove(ˎ);
                if (dVar != null) {
                    dVar.ˊ(null);
                }
            }
        }
    }
}
